<?php
/*
php标准格式；
学习模板！
*/
header("content-type:text/html;charset=UTF-8");
$id = isset($_GET['id'])? $_GET['id'] : null;
$name = isset($_GET['name'])? $_GET['name'] : null;
if(!isset($id) && !isset($name))
{
	echo '非法的请求！';
	exit;
}
require "connect.php";
$sql = "select * from students where id={$id} and name='{$name}';";
$ret_que = mysql_query($sql);
if(mysql_num_rows($ret_que)==0)
{
	echo "<script type='text/javascript'>
	alert('错误的信息');
	location.href='admin.php';
	</script>";
	exit;
}
$row = mysql_fetch_assoc($ret_que);

?>
<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <title>修改学生信息</title>
 <style type="text/css">
 	body{
		background-color: #b4b4b4;
	        }
 	.Form＿css{
 		/*float: left;*/
 		 
 		height: 300px;
 		width: 400px;
 		margin:5px auto;
 	}
 </style>
 <script type="text/javascript">

 	function $(id)
 	{
 		return document.getElementById(id).value;
 	}
 	function loginclick()
 	{
 		//先判断学生编号是不是数字
 		//首先需要获取学生编号里的内容
 		var student_ID = $("_id");
 		if (isNaN(student_ID)) {
 			alert("请填写正确的学生编号！");
 			window.location.href='index.php';
 			return false;
 		} else if(isNaN($("_chinese"))){
 			alert("请填写正确的学生学生成绩！");
 			window.location.href='index.php';
 			return false;
 		}else if(isNaN($("_math"))){
 			alert("请填写正确的学生学生成绩！");
 			window.location.href='index.php';
 			return false;
 		}else if(isNaN($("_english"))){
 			alert("请填写正确的学生学生成绩！");
 			window.location.href='index.php';
 			return false;
 		}else if($("_name").length ==0)
 		{
 			alert("姓名不能为空！");
 			window.location.href='index.php';
 			return false;
 		}
 		
 		return true;

 	}
 </script>
</head>
<body>
<div class="Form＿css">
	<form  action="update.php" method="post" onsubmit="return loginclick();">
	学生编号：<input type="text" name="m_id"  id="m_id" disabled="disabled" value="<?=$row['id']?>"><br/>
	学生名字：<input type="text" name="m_name" id="m_name" disabled="disabled" value="<?=$row['name']?>"><br/>
	<input type="hidden" name="_id" id="_id" value="<?=$row['id']?>">
	<input type="hidden" name="_name" id="_name" value="<?=$row['name']?>">
	语文成绩：<input type="text" name="_chinese" id="_chinese" value="<?=$row['chinese']?>"><br/>
	数学成绩：<input type="text" name="_math" id="_math" value="<?=$row['math']?>"><br/>
	英语成绩：<input type="text" name="_english" id="_english" value="<?=$row['english']?>"><br/>
	<input type="submit" name="submit" value="修改"><br/>
	</form>
</div>
	<!--<table border=1px class="student_table">
		<th>学生编号：</th><th>学生名字：</th><th>语文成绩：</th>
		<th>数学成绩：</th><th>英语成绩：</th>
	</table>-->
</body>
</html>